<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>css导航下划线动画效果</title>
</head>
<style>
  .items {
    display: flex
  }

  .item {
    width: 100px;
    height: 60px;
    text-align: center;
    line-height: 60px;
    background-color: black;
    color: white;
    position: relative;
  }

  .item:before {
    content: '';
    height: 4px;
    background-color: #BADFED;
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 0;
    transform: scaleX(0);
    transition: .3s;
  }

  .item:hover:before {
    transform: scaleX(1);
  }
</style>

<body>
  <div class="items">
    <div class="item">因为</div>
    <div class="item">所以</div>
    <div class="item">无所谓</div>
  </div>
</body>

</html>